gdk/wayland: Restrict shortcut inhibition to keyboard grabs on toplevels
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 26 Oct 2017 10:09:44 +0000 (12:09 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 30 Nov 2017 17:54:47 +0000 (18:54 +0100)
It is unlikely that popup windows will contain anything that requires this
(popup menus being more interested in redirecting keyboard focus to
themselves). OTOH popup implementations that just grab the keyboard are
commonplace enough, it makes sense not to trigger inhibition for these.

https://bugzilla.gnome.org/show_bug.cgi?id=789268

gdk/wayland/gdkdevice-wayland.c

index 7babcc0b0142c831c93a79e824de8c0f436ad290..0f2afd0f42ad66f22ad33d744578a229f073f0c1 100644 (file)
@@ -756,8 +756,12 @@ gdk_wayland_device_grab (GdkDevice    *device,
   if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
     {
       /* Device is a keyboard */
-      gdk_wayland_window_inhibit_shortcuts (window,
-                                            gdk_device_get_seat (device));
+      if (gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL)
+        {
+          gdk_wayland_window_inhibit_shortcuts (window,
+                                                gdk_device_get_seat (device));
+        }
+
       return GDK_GRAB_SUCCESS;
     }
   else
@@ -4787,8 +4791,9 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
                                     evtime,
                                     FALSE);
 
-      /* Inhibit shortcuts if the seat grab is for the keyboard only */
-      if (capabilities == GDK_SEAT_CAPABILITY_KEYBOARD)
+      /* Inhibit shortcuts on toplevels if the seat grab is for the keyboard only */
+      if (capabilities == GDK_SEAT_CAPABILITY_KEYBOARD &&
+          native->window_type == GDK_WINDOW_TOPLEVEL)
         gdk_wayland_window_inhibit_shortcuts (window, seat);
     }